import { _decorator, Component, Node, Sprite, SpriteFrame } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('SingleBtn')
export class SingleBtn extends Component {

    @property(SpriteFrame)
    selected:SpriteFrame = null
    @property(SpriteFrame)
    noSelected:SpriteFrame = null

    @property([Sprite])
    tags: Sprite[] = []

    start() {

    }

    onBtn(e,str:string){
        this.set_no_selected();
        
        const num = Number(str)
        this.tags[num].spriteFrame = this.selected
    }

    set_no_selected(){
        this.tags.forEach(element => {
            element.spriteFrame = this.noSelected;
        });
    }
}


